import type {
  AddCardData,
  CardListQuery,
  CardListRes,
  CardDetailRes,
  EditCardData
} from "@/types/card";
import { request } from "@/utils/reuqest";

/**
 * 获取月卡列表
 */
export const getCardListAPI = (params: CardListQuery) => {
  return request<CardListRes>("/parking/card/list", "GET", params);
};

/**
 * 新增月卡
 */
export const addCardAPI = (data: Partial<AddCardData>) => {
  return request("/parking/card", "POST", data);
};

/**
 * 获取编辑页月卡详情
 */
export const getCardDetailAPI = (id: string) => {
  return request<CardDetailRes>(`/parking/card/detail/${id}`, "GET");
};

/**
 * 编辑月卡
 */
export const editCardAPI = (data: Partial<EditCardData>) => {
  return request("/parking/card/edit", "PUT", data);
};

/**
 * 删除月卡
 */
export const deleteCardAPI = (ids: string) => {
  return request(`/parking/card/${ids}`, "DELETE");
};